package com.ckh.springboot.controller;


import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ckh.springboot.common.Constants;
import com.ckh.springboot.common.Result;
import com.ckh.springboot.entity.*;
import com.ckh.springboot.service.IJoinClassService;
import com.ckh.springboot.service.INoticeClassService;
import com.ckh.springboot.service.IStudentClockService;
import com.ckh.springboot.service.ISysClassService;
import com.ckh.springboot.vo.GetClassInfoVo;
import com.ckh.springboot.vo.StudentClockInVo;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ckh
 * @since 2022-04-04
 */
@RestController
@RequestMapping("/api/NoticeClass")
@CrossOrigin(origins = "http://localhost:9528")
public class NoticeClassController {


    @Resource
    private INoticeClassService noticeClassService;


    /**
     * Description:a
     * 公告删除
     * @param null:
     * @author: luoCan
     */
    @PostMapping("/deleteNoticeClass")
    public Result deleteNoticeClass(@RequestBody NoticeClass noticeClass) {
        return Result.success(noticeClassService.removeById(noticeClass));
    }

    /**
     * Description:a
     * 公告新增
     * @param null:
     * @author: luoCan
     */
    @PostMapping("/saveNoticeClass")
    public Result saveNoticeClass(@RequestBody NoticeClass noticeClass) {
        return Result.success(noticeClassService.save(noticeClass));
    }


    /**
     * Description:a
     * 公告列表
     * @param null:
     * @author: luoCan
     */
    @GetMapping("/getNoticeClassList")
    public Result getNoticeClassList(String name,
                                      @RequestParam Integer pageNum,
                                      @RequestParam Integer pageSize) {
        return Result.success(noticeClassService.getNoticeClassList(new Page<>(pageNum, pageSize), name));
    }


}

